<?php
namespace slinks\extensions\twig\core;

/**
 * Creates a Twig environment.
 *
 * @author navid
 * @Service('twig')
 */
class TwigEnvironmentFactory {
    
    /**
     * Initialize the Twig engine. Can provide options if desired.
     *
     * Available options:
     *
     *  * debug: When set to `true`, the generated templates have a __toString()
     *           method that you can use to display the generated nodes (default to
     *           false).
     *
     *  * charset: The charset used by the templates (default to utf-8).
     *
     *  * base_template_class: The base template class to use for generated
     *                         templates (default to Twig_Template).
     *
     *  * cache: An absolute path where to store the compiled templates, or
     *           false to disable compilation cache (default)
     *
     *  * auto_reload: Whether to reload the template is the original source changed.
     *                 If you don't provide the auto_reload option, it will be
     *                 determined automatically base on the debug value.
     *
     *  * strict_variables: Whether to ignore invalid variables in templates
     *                      (default to false).
     *
     *  * autoescape: Whether to enable auto-escaping (default to true);
     *
     *  * optimizations: A flag that indicates which optimizations to apply
     *                   (default to -1 which means that all optimizations are enabled;
     *                   set it to 0 to disable)
     *
     * @param array                  $options An array of options
     * 
     * @FactoryMethod('%twig.options%')
     */
    public static function createTwigEnvironment(array $twigOptions){
        return new \Twig_Environment(null, $twigOptions);
    }
    
    
}
